OS_NAME := $(shell uname -s)

ifeq ($(OS_NAME),Linux)
	os = linux
else ifeq ($(OS_NAME),Darwin)
	os = macos
else
	os = windows
endif

target=cloudc
source=main.cc
pub=../public

cxx=g++
args=-std=c++11 -ljsoncpp

ifeq ($(os),macos)
    args += -framework CoreFoundation -framework CoreServices
endif

.PHONY: public clean

bin:$(source)
	$(cxx) -o $(target) $^ $(args)

public:
	if [ -e $(target) ]; then \
		mv -f $(target) $(pub); \
	fi
	
clean:
	rm -rf $(target)

